package basic.lessons;

public class BiggestDivisorsCount {
	
	public static void main(String[] args) {
		
		int topRangeNumber = 0; // MAX range int number to define divisors
		int divisorsCount =0; // divisors count
		int currentNumber = 0; // integer having max divisors
		int maxDivisorsCount =0; // current max divisors count
		int largestDivisorsNumber = 0; // number having max divisors
		for (int i = 10000; i >1; i-- )
		{
			for (int j = (int)i/2; j >1; j--)
			{
				if (i % j == 0)
					divisorsCount ++;
			}	
			if(maxDivisorsCount<divisorsCount )
			{
				maxDivisorsCount = divisorsCount;
				divisorsCount = 0;
				largestDivisorsNumber = i;
				
			}
			divisorsCount = 0;
		}
		System.out.println("largestDivisorsNumber = " +largestDivisorsNumber);
		System.out.println("maxDivisorsCount = " +maxDivisorsCount);

	}

}
